package com.example.springboot.contronller;

import com.example.springboot.exception.BusException;
import com.example.springboot.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.springboot.pojo.vo.GlobalResultVo;
import javax.validation.Valid;
import java.util.ArrayList;

/**
 * @author: wyb
 * @date: 2021/10/29 10:40
 * @describe:
 * @vision 1.0
 */
@RestController
@RequestMapping("user")
@Api(tags = "用户模块")
public class UserController {

    @PostMapping("/addUser")
    @ApiOperation(value = "添加用户")
    public GlobalResultVo addUser(@RequestBody @Valid User user) {

        try {
            ArrayList<User> list = new ArrayList<>();
            User u1 = new User();
//            u1.setAccount("11");
//            u1.setEmail("11");
            list.add(u1);
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BusException(e.getMessage(),e);
        }
    }


    @PostMapping("/addUser1")
    @ApiOperation(value = "修改用户")
    public GlobalResultVo updateUser(@RequestBody @Valid User user) {

        try {
            ArrayList<User> list = new ArrayList<>();
            User u1 = new User();
//            u1.setAccount("11");
//            u1.setEmail("11");
            list.add(u1);
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BusException(e.getMessage(),e);
        }
    }
}